﻿<UserControl x:Class="XWord.GUI.Views.Fundamental.EtymaCategoryExplorerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:cal="http://www.caliburnproject.org"
             xmlns:inf="http://www.grandsys.com/luna"
             xmlns:info="http://schemas.xword.com/winfx/xaml/info"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Style TargetType="TreeView" BasedOn="{StaticResource {x:Type TreeView}}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <HierarchicalDataTemplate>
                        <StackPanel Orientation="Horizontal">
                        <TextBlock x:Name="TextBlock_Part" Text="{Binding Name}" ToolTip="{Binding Comment}"></TextBlock>
                            <TextBlock Text="{Binding ItemsSource.Count,RelativeSource={RelativeSource AncestorType=TreeViewItem,Mode=FindAncestor},StringFormat=  ({0})}">
                            </TextBlock>
                        </StackPanel>
                        <HierarchicalDataTemplate.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding}"/>
                            </DataTemplate>
                        </HierarchicalDataTemplate.ItemTemplate>
                        <!--<HierarchicalDataTemplate.Triggers>
                            <DataTrigger Binding="{Binding HasItems,RelativeSource={RelativeSource AncestorType=TreeViewItem,Mode=FindAncestor}}" Value="True">
                                <Setter TargetName="TextBlock_Part" Property="Text" Value=""
                            </DataTrigger>
                        </HierarchicalDataTemplate.Triggers>-->
                    </HierarchicalDataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <inf:DockingWindowMetadata.Instance>
        <inf:DockingWindowMetadata Title="{Binding DisplayName}" IsToolWindow="True" DefaultDock="Right"
                                    CanClose="False" CreateNewDockingGroup="True" />
    </inf:DockingWindowMetadata.Instance>
    <Grid>
        <TabControl>
            <TabItem>
                <TabItem.Header>
                    <TextBlock Text="{Binding PrefixEtymaList.Count,StringFormat=前缀({0})}"/>
                </TabItem.Header>
                <TreeView TreeViewItem.Selected="TreeView_Selected" VirtualizingStackPanel.IsVirtualizing="True"
                          BorderThickness="0" ItemsSource="{Binding PrefixEtymaList}">
                 
                </TreeView>
             
            </TabItem>
            <TabItem>
                <TabItem.Header>
                    <TextBlock Text="{Binding EtymonList.Count,StringFormat=词根({0})}"/>
                </TabItem.Header>
                <TreeView TreeViewItem.Selected="TreeView_Selected" VirtualizingStackPanel.IsVirtualizing="True"
                          BorderThickness="0" ItemsSource="{Binding EtymonList}">
                </TreeView>
                
            </TabItem>
            <TabItem>
                <TabItem.Header>
                    <TextBlock Text="{Binding SuffixEtymaList.Count,StringFormat=后缀({0})}"/>
                </TabItem.Header>
                <TreeView TreeViewItem.Selected="TreeView_Selected" VirtualizingStackPanel.IsVirtualizing="True"
                          BorderThickness="0" ItemsSource="{Binding SuffixEtymaList}">
                </TreeView>
            </TabItem>
        </TabControl>
        <!--<TreeView VirtualizingStackPanel.IsVirtualizing="True" BorderThickness="0">
            <TreeViewItem DisplayMemberPath="Name" Header="前缀" ItemsSource="{Binding PrefixEtymaList}">
                
            </TreeViewItem>
        </TreeView>
            <TreeView VerticalAlignment="Top" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True" BorderThickness="0">
                <TreeViewItem DisplayMemberPath="Name" Header="后缀" ItemsSource="{Binding SuffixEtymaList}">
                </TreeViewItem>
            </TreeView>-->
    </Grid>
</UserControl>
